package com.ellricky.baselib.adapter.cla

import android.app.Activity
import android.widget.CheckBox
import android.widget.TextView
import com.andr.common.ui.adapter.BaseRecyclerAdapter
import com.andr.common.ui.adapter.SmartViewHolder
import com.ellricky.baselib.R
import com.ellricky.baselib.entity.cla.TcAddEntity
import com.ellricky.baselib.entity.new.TeacherList
import com.ellricky.baselib.util.GlideUtil
import de.hdodenhof.circleimageview.CircleImageView

class TeacherAddAdapter(val activity: Activity)
    : BaseRecyclerAdapter<TeacherList>(R.layout.base_adapter_teacher_add) {

    var choosePos = -1

    public override fun onBindViewHolder(holder: SmartViewHolder, model: TeacherList, position: Int) {
        val itemView = holder.itemView

        val cb = itemView.findViewById<CheckBox>(R.id.cb)
        cb.isChecked = choosePos == position

        // 头像
        val iv = itemView.findViewById<CircleImageView>(R.id.ivPic)
        val picUrl = model.head_img
        GlideUtil.into(activity, picUrl, iv)


        val tvName = itemView.findViewById<TextView>(R.id.tvName)
        tvName.text = model.name

    }
}
